home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / vbprnt20.zip / SRC / VBAPI.H < prev    next >
C/C++ Source or Header  |  1996-05-29  |  40KB  |  1,066 lines

  1. //---------------------------------------------------------------------------
  2. // VBAPI.H
  3. //---------------------------------------------------------------------------
  4. // Copyright (c) 1991-1993, Microsoft Corp.  All Rights Reserved.
  5. //---------------------------------------------------------------------------
  6. // Include file for the Visual Basic Custom Control and DLL application
  7. // programming interface.
  8. //---------------------------------------------------------------------------
  9.  
  10. //---------------------------------------------------------------------------
  11. // Handle C++ and Pack structures on 1-byte boundaries
  12. //---------------------------------------------------------------------------
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16.  
  17. #ifndef RC_INVOKED
  18. #pragma pack(1)
  19. #endif    // ifndef RC_INVOKED
  20.  
  21.  
  22.  
  23. //---------------------------------------------------------------------------
  24. // Version constants
  25. //---------------------------------------------------------------------------
  26. #define VB100_VERSION    0x0100
  27. #define VB200_VERSION    0x0200
  28. #define VB300_VERSION    0x0300
  29. #define VB_VERSION    VB300_VERSION
  30.  
  31.  
  32. //---------------------------------------------------------------------------
  33. // General types and modifiers
  34. //---------------------------------------------------------------------------
  35. typedef   signed short    SHORT;        // s
  36. typedef unsigned short    USHORT;     // u
  37. typedef unsigned int    FSHORT;     // fs
  38. typedef   signed char    CHAR;        // ch
  39. typedef unsigned char    ENUM;        // enum
  40. typedef unsigned long    ULONG;        // ul
  41. typedef unsigned long    FLONG;        // fl
  42. typedef SHORT       FAR *LPSHORT;    // lps
  43. typedef USHORT       FAR *LPUSHORT;    // lpu
  44. typedef USHORT          IPROP;          // iprop
  45. typedef HANDLE        HFORMFILE;    // hformfile
  46. typedef USHORT        ERR;        // err
  47. typedef WORD        HPIC;        // hpic
  48. typedef HPIC       FAR *LPHPIC;     // lphpic
  49.  
  50. #ifndef WIN32
  51. typedef LPSTR        HSZ;        // hsz
  52. #endif
  53.  
  54. typedef LPVOID        HLSTR;        // hlstr
  55. typedef HLSTR       FAR *LPHLSTR;    // lphlstr
  56. typedef LPVOID        HAD;        // hAD - handle to Basic array desc.
  57. typedef LPVOID        HCTL;        // hctl
  58. typedef LONG (FAR PASCAL *PFNWP)(HWND hwnd, USHORT msg, USHORT wp, LONG lp);            // pfnwp
  59. typedef LONG (FAR PASCAL *PCTLPROC)(HCTL hctl, HWND hwnd, USHORT msg, USHORT wp, LONG lp);  // pctlproc
  60.  
  61.  
  62. //---------------------------------------------------------------------------
  63. // Language Variant structures
  64. //---------------------------------------------------------------------------
  65. typedef struct
  66.   {
  67.   LONG lo;
  68.   LONG hi;
  69.   } CURRENCY;
  70.  
  71. typedef union
  72.   {
  73.   SHORT    i2;
  74.   LONG       i4;
  75.   float    r4;
  76.   double   r8;
  77.   CURRENCY cy;
  78.   HLSTR    hlstr;
  79.   } VALUE;
  80.  
  81. typedef VALUE FAR *LPVAL;
  82.  
  83. // The size of Variant is needed when a Variant is passed by value or in a
  84. // structure (user-defined type).
  85. typedef struct
  86.   {
  87.   char v[16];
  88.   } VARIANT;
  89.  
  90. typedef VARIANT FAR *LPVAR;
  91.  
  92. // Variant type constants. these are the return value of GetVariantType.
  93. // these are also defined in Constant.Txt for return value of VarType()
  94. #define VT_EMPTY    0    // Empty
  95. #define VT_NULL     1    // Null
  96. #define VT_I2        2    // Integer
  97. #define VT_I4        3    // Long
  98. #define VT_R4        4    // Single
  99. #define VT_R8        5    // Double
  100. #define VT_CURRENCY 6    // Currency
  101. #define VT_DATE     7    // Date
  102. #define VT_STRING   8    // String
  103.  
  104.  
  105. //---------------------------------------------------------------------------
  106. // COLOR - a Windows RGB DWORD value.
  107. //---------------------------------------------------------------------------
  108. typedef unsigned long COLOR;
  109. typedef COLOR     FAR *LPCOLOR;          // lpcolor
  110.  
  111. #define COLOR_DEFBITON    0x80000000    // bit set -> Win SysColor, not RGB
  112.  
  113. // Get RGB value from a color.
  114. #define RGBCOLOR(clr) \
  115.   (((clr)&COLOR_DEFBITON)?(GetSysColor((int)((clr)&0xFFFF))):((clr)&0xFFFFFF))
  116.  
  117.  
  118. //---------------------------------------------------------------------------
  119. // Property data structure
  120. //---------------------------------------------------------------------------
  121. typedef struct tagDATASTRUCT
  122.   {
  123.   LONG     data;            // Data for Get/Set
  124.   USHORT cindex;        // Number of indecies
  125.   struct
  126.     {
  127.     USHORT datatype;        // Type of nth index (Currently always DT_SHORT)
  128.     LONG   data;        // Value of nth index
  129.     } index[1];         // Currently, only 1-dim arrays supported
  130.   } DATASTRUCT;
  131.  
  132. typedef DATASTRUCT FAR    *LPDATASTRUCT;    // pds
  133. typedef DATASTRUCT NEAR *NPDATASTRUCT;    // npds
  134.  
  135.  
  136. //---------------------------------------------------------------------------
  137. // VISUAL BASIC variable types
  138. //---------------------------------------------------------------------------
  139. #define ET_I2        1   // 16 bit signed integer scalar or array variable
  140. #define ET_I4        2   // 32 bit signed integer scalar or array variable
  141. #define ET_R4        3
  142. #define ET_R8        4   // 64 bit real scalar or array variable
  143. #define ET_CY        5   // 64 bit currency scalar or array variable
  144. #define ET_HLSTR    6   // string scalar or array variable
  145. #define ET_SD        6   // older, unpreferred equivalent to ET_HLSTR
  146. #define ET_FS        7   // fixed-length string variable
  147.  
  148.  
  149. //---------------------------------------------------------------------------
  150. // Control Property definitions and structures.
  151. //---------------------------------------------------------------------------
  152. #define PF_datatype        0x000000FFL
  153. #define PF_fPropArray        0x00000100L
  154. #define PF_fSetData        0x00000200L
  155. #define PF_fSetMsg        0x00000400L
  156. #define PF_fNoShow        0x00000800L
  157. #define PF_fNoRuntimeW        0x00001000L
  158. #define PF_fGetData        0x00002000L
  159. #define PF_fGetMsg        0x00004000L
  160. #define PF_fSetCheck        0x00008000L
  161. #define PF_fSaveData        0x00010000L
  162. #define PF_fSaveMsg        0x00020000L
  163. #define PF_fLoadDataOnly    0x20010000L
  164. #define PF_fLoadMsgOnly     0x20020000L
  165. #define PF_fGetHszMsg        0x00040000L
  166. #define PF_fUpdateOnEdit    0x00080000L
  167. #define PF_fEditable        0x00100000L
  168. #define PF_fPreHwnd        0x00200000L
  169. #define PF_fDefVal        0x00400000L
  170. #define PF_fNoInitDef        0x00800000L
  171. #define PF_fNoRuntimeR        0x02000000L
  172. #define PF_fNoMultiSelect   0x04000000L
  173.  
  174. typedef struct tagPROPINFO
  175.   {
  176.   PSTR    npszName;
  177.   FLONG    fl;            // PF_ flags
  178.   BYTE    offsetData;        // Offset into static structure
  179.   BYTE    infoData;        // 0 or _INFO value for bitfield
  180.   LONG    dataDefault;        // 0 or _INFO value for bitfield
  181.   PSTR    npszEnumList;        // For type == DT_ENUM, this is
  182.                 // a near ptr to a string containing
  183.                 // all the values to be displayed
  184.                 // in the popup enumeration listbox.
  185.                 // Each value is an sz, with an
  186.                 // empty sz indicated the end of list.
  187.   BYTE    enumMax;        // Maximum legal value for enum.
  188.   } PROPINFO;
  189.  
  190. typedef PROPINFO  FAR  * LPPROPINFO;
  191. typedef PROPINFO  NEAR * NPPROPINFO;
  192. typedef PROPINFO  NEAR *  PPROPINFO;
  193. typedef PPROPINFO FAR  * LPPROPLIST;
  194. typedef PPROPINFO NEAR * NPPROPLIST;
  195. typedef PPROPINFO NEAR *  PPROPLIST;
  196.  
  197.  
  198. //---------------------------------------------------------------------------
  199. // Values for PROP PF_datatype
  200. //---------------------------------------------------------------------------
  201. #define DT_HSZ          0x01
  202. #define DT_SHORT      0x02
  203. #define DT_LONG       0x03
  204. #define DT_BOOL       0x04
  205. #define DT_COLOR      0x05
  206. #define DT_ENUM       0x06
  207. #define DT_REAL       0x07
  208. #define DT_XPOS       0x08    // Scaled from float to long twips
  209. #define DT_XSIZE      0x09    //   _SIZE scales without origin
  210. #define DT_YPOS       0x0A    //   _POS subtracts origin
  211. #define DT_YSIZE      0x0B    // uses parent's scale properties
  212. #define DT_PICTURE    0x0C
  213. #define DT_HLSTR      0x0D
  214. #define DT_OBJECT     0x20
  215.  
  216.  
  217. //---------------------------------------------------------------------------
  218. // Control event definitions and structures.
  219. //---------------------------------------------------------------------------
  220. #define EF_fNoUnload    0x00000001L
  221.  
  222. typedef struct tagEVENTINFO
  223.   {
  224.   PSTR        npszName;    // event procedure name suffix
  225.   USHORT    cParms;     // number of parameters
  226.   USHORT    cwParms;    // # words of parameters
  227.   PWORD        npParmTypes;    // list of parameter types
  228.   PSTR        npszParmProf;    // event parameter profile string
  229.   FLONG        fl;        // EF_ flags
  230.   } EVENTINFO;
  231.  
  232. typedef EVENTIN